import Vue from 'vue'
import App from './App.vue'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
import router from './router'
import store from './store'

Vue.use(Antd);
Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
    console.log(to.fullPath)
    if(to.meta && !to.meta.noRequireAuth){
      if (localStorage.getItem('isLogin')) {
        next()
      } else {
        next({path:'/login'})
      }
    }else {
      next();
    }
    document.title = to.meta ? to.meta.title : '';
});

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')
